package com.zzc.fwzpxt.service.impl;

import com.zzc.fwzpxt.entity.Comment;
import com.zzc.fwzpxt.mapper.CommentMapper;
import com.zzc.fwzpxt.service.ICommentService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author XiaoBingBy
 * @since 2017-09-26
 */
@Service
public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment> implements ICommentService {

    @Autowired
    private CommentMapper commentMapper;
    @Override
    public boolean deleteCommentByIds(String id) {
        String[] split = id.split(",");
        for (String item:split) {
            Comment comment = new Comment();
            comment.setId(Long.valueOf(item));
            comment.setStatus(0);
            commentMapper.updateById(comment);
        }
        return true;
    }

    @Override
    public boolean auditComment(String id) {
        String[] split = id.split(",");
        for (String item:split) {
            Comment comment = new Comment();
            comment.setId(Long.valueOf(item));
            comment.setStatus(2);
            commentMapper.updateById(comment);
        }
        return true;
    }
}
